import java.io.*;
import java.net.*;

public class DateServer {
	public static void main(String[] args) throws IOException {
		ServerSocket serverSocket = new ServerSocket(2002);
		System.out.println("Server started listening on port " +
			serverSocket.getLocalPort() + ".");
		while (true) {
			Socket socket = serverSocket.accept();
			OutputStreamWriter out = new OutputStreamWriter(
				socket.getOutputStream());
			out.write(new java.util.Date() + "\n");
			out.close();
			socket.close();
		}
	}
}
